package com.aloda.service;

import com.aloda.dto.question.QuestionAnswerDTO;
import com.aloda.entity.UserAnswer;
import com.aloda.query.AnswerRecordPageDTO;
import com.aloda.query.PageQuery;
import com.aloda.query.UserAnswerPageDTO;
import com.aloda.result.PageResult;
import com.aloda.vo.userAnswer.AnswerRecordPageVO;
import com.aloda.vo.userAnswer.UserAnswerInfoVO;
import com.aloda.vo.userAnswer.UserAnswerPageVO;
import com.aloda.vo.userAnswer.UserAnswerResultVO;
import com.baomidou.mybatisplus.extension.service.IService;
import jakarta.servlet.http.HttpServletResponse;

import java.util.List;

/**
* @author aloda
* @description 针对表【user_answer(用户答题记录)】的数据库操作Service
* @createDate 2025-03-05 16:27:38
*/
public interface UserAnswerService extends IService<UserAnswer> {

    /**
     * 分页查询
     * @param userAnswerPageDTO 查询条件
     * @return 分页结果
     */
    PageResult<UserAnswerPageVO> pageQuery(UserAnswerPageDTO userAnswerPageDTO);

    /**
     * 导出用户答题记录信息表格
     * @param response HttpServletResponse 对象
     * @param ids ID 列表
     */
    void exportToExcel(HttpServletResponse response, List<Long> ids);

    /**
     * 新增用户回答记录
     * @param questionAnswerDTO
     * @return
     */
    Long addUserAnswer(QuestionAnswerDTO questionAnswerDTO);

    /**
     * 根据id查询回答记录
     * @param id
     * @return
     */
    UserAnswerResultVO getUserAnswerResultById(Long id);

    /**
     * 客户端分页查询答题记录
     * @param answerRecordPageDTO
     * @return
     */
    PageResult<AnswerRecordPageVO> pageQueryByUser(AnswerRecordPageDTO answerRecordPageDTO);

    /**
     * 用户端删除答题记录
     * @param ids
     * @return
     */
    long deleteByIds(List<Long> ids, Long appId);

    /**
     * 导出excel
     * @param ids
     * @param response
     */
    void exportRecordsToExcel(List<Long> ids, HttpServletResponse response, Long appId);

    /**
     * 分页查询用户本人的答题记录
     * @param pageQuery
     * @return
     */
    PageResult<AnswerRecordPageVO> pageQueryUserAR(PageQuery pageQuery);
}
